home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 050 / pasclib.arc / PASCLIB1.DOC < prev   
Encoding:
Text File  |  1986-05-03  |  8.0 KB  |  220 lines

  1.  
  2.  
  3.                      PASCLIB Version 1.0 (Copyright 1985)
  4.     =======================================================================
  5.                         by:  Gerry L. Kilgore
  6.                              1725 Kellogg Springs Dr.
  7.                              Dunwoody, GA 30338
  8.                              (404) 396-6107 (Voice)
  9.     =======================================================================
  10.  
  11.     PASCLIB is a library of floating point subroutines, a sine/cosine sub-
  12.     routine, a random number function and a ramdomize program to seed the
  13.     random number generator.
  14.  
  15.     The library was written in Assembler language primarily to interface
  16.     with IBM/MS Pascal programs to obtain great speed without giving up
  17.     single precision accuracy such as required by graphics programs using
  18.     mathematical functions or plotting.  Other applications, not requiring
  19.     the accuracy of long precision can, of course, benefit from use of this
  20.     library.
  21.  
  22.     WHY BOTHER??  Simply put, because they perform approximately five (5)
  23.     times faster that the equivalent operations using short precision in
  24.     IBM/MS Pascal.  They are not hampered by generalized overhead.
  25.  
  26.     The library is equally useable by Assembler Language programmers.  In
  27.     fact, it was constructed with a separate EXTERNAL interface which, in
  28.     turn, calls the INTERNAL routines.  The Assembler Language programmer
  29.     can bypass the EXTERNAL interface and go directly to the INTERNAL
  30.     routines, if he obtains the A/L source.  If not, he may still use the
  31.     EXTERNAL calls.
  32.  
  33.     I am declaring this program in the Public Domain under the Freeware
  34.     Concept.  That is, you are free to copy and distribute this library
  35.     as long as you do so without financial gain.  If you find it useful,
  36.     and feel that it is justified, this author will not turn down any 
  37.     contributions ($20.00 is reasonable).  For your contribution of at
  38.     least $20.00 along with a self-addressed diskette mailer with return
  39.     postage affixed, I will send you a diskette with the commented 
  40.     Assembler Language source of PASCLIB, additional documentation on how
  41.     to call the internal routines, and I will put you on my mailing
  42.     list for notification of fixes, enhancements and upgrades.  Send
  43.     contributions to the address shown above.
  44.  
  45.     DISCLAIMER:  This author will not be held accountable for any
  46.     problems or damages associated with the use of PASCLIB whether they
  47.     be physical, financial or psychological.  If you use PASCLIB, you
  48.     use it at your own risk!
  49.  
  50.     ======================================================================
  51.  
  52.  
  53.                           WHAT'S IN THE PACKAGE?
  54.                           ======================
  55.  
  56.     You have:
  57.                PASCLIB.INC   - the "INCLUDE" file for IBM/MS Pascal
  58.                PASCLIB.OBJ   - the subroutine object module.
  59.                PASCLIB.DOC   - this documentation.
  60.  
  61.     In IBM/MS Pascal, you must place an "INCLUDE" statement in your
  62.     program as if you were defining a function or procedure.  This will
  63.     permit you to invoke the Functions and Procedures of PASCLIB.OBJ.
  64.     That statement will be as follows:
  65.  
  66.     {$INCLUDE:'PASCLIB.INC'}
  67.  
  68.     with no semi-colon following the statement.  You may, of course, pre-
  69.     cede the name, PASCLIB.INC, with a drive specifier, such as,
  70.  
  71.     {$INCLUDE:'B:PASCLIB.INC'}
  72.  
  73.     if PASCLIB.INC is not on the default drive.
  74.  
  75.     PASCLIB.INC contains the following external procedure and function
  76.     definitions:
  77.  
  78.         procedure randomize; external;
  79.         function random ( n : integer): integer; external;
  80.         function f_add( op1, op2: real): real; external;
  81.         function f_sub( op1, op2: real): real; external;
  82.         function f_mult(op1, op2: real): real; external;
  83.         function f_div( op1, op2: real): real; external;
  84.         procedure sinlook( arg: integer; var sin: real); external;
  85.         procedure coslook( art: integer; var cos: real); external;
  86.         function ifloat( arg: integer): real; external;
  87.         function fltrunc( arg: real): integer; external;
  88.         function fround( arg: real): integer; external;
  89.         function fltmod (art: real): real; external;
  90.         function rsin( arg: real): real; external;
  91.         function rcos( arg: real): real; external;
  92.         function craddeg( rad: real): real; external;
  93.  
  94.     In addition, you will need to insert the follwoing statement in
  95.     your program in order to tell IBM/MS Pascal that you are working
  96.     with SHORT Precision real numbers:
  97.  
  98.         procedure mpsrqq; external;
  99.  
  100.     This procedure is internal to the PASCAL.LIB library and is linked
  101.     into your program automatically when you perform the LINK function.
  102.  
  103.  
  104.     HOW DO I USE THEM?
  105.  
  106.     1. Randomize is a procedure with no arguments. It seeds the random
  107.        number generator for the function, Random.  This is accomplished
  108.        by accessing the system clock or timer.
  109.  
  110.        Use:
  111.  
  112.             randomize;
  113.  
  114.        That's all there is to that one.
  115.  
  116.  
  117.  
  118.     2. Random is a function that returns a random integer.
  119.   
  120.        Use:
  121.    
  122.             y := random(a);
  123.  
  124.           or
  125.  
  126.             if ( random(a) > 50 ) then ........
  127.  
  128.         'a' must be an integer and random (a) will return a random
  129.         integer such that
  130.  
  131.                       0 < random(a) < a.
  132.  
  133.     
  134.      3. F_add is a function that performs a single precision floating point
  135.         add of two real numbers returning their real sum.
  136.  
  137.         Use:
  138.  
  139.             y := f_add (a, b);
  140.  
  141.         Adds 'b' to 'a' and returns their sum in y.
  142.  
  143.  
  144.      4. F_sub is the same as f_add, except for,
  145.  
  146.             y := f_sub (a, b);
  147.  
  148.         'b' is subtracted FROM 'a' and the difference is stored in 'y'.
  149.  
  150.  
  151.      5. F_mult is a function that performs a single precision floating 
  152.         point multiplication of two real numbers returning their real prod-
  153.         duct.
  154.  
  155.         Use:
  156.  
  157.             y := f_mult(a, b);
  158.  
  159.         'a' is multiplied by 'b' and the product is stored in 'y'. I might
  160.         add that these functions can be nested.  For example:
  161.  
  162.             z := f_add ( f_mult ( a, b ), c );
  163.  
  164.         is completely valid, since f_mult ( a, b ) is a real number and we
  165.         presume that so is 'c'.
  166.  
  167.  
  168.  
  169.      6. F_div is the floating point division function where if,
  170.  
  171.             y := f_div (a, b);
  172.  
  173.         then 'a' is divided BY 'b' and the quotient is stored in 'y'.  In
  174.         this case, 'a' is the dividend and 'b' is the divisor.  Division 
  175.         by zero returns a zero, by the way.
  176.  
  177.      
  178.      7. Sinlook is a procedure that returns a real number which is the
  179.         trignometric sine of an integer number of degrees.  PASLIB.OBJ
  180.         contains a sine/cosine table of the real sine of integer degrees.
  181.         It can very quickly determine the sine of a number by performing
  182.         a binary search on this table.
  183.  
  184.         Use:
  185.  
  186.              sinlook (a , b);
  187.  
  188.         where 'a' is the integer representation of the number of degrees
  189.         and the sine of 'a' is returned in the real variable, 'b'. (Note
  190.         that while 'a' may be a literal, 'b' MUST be a variable)  For
  191.         example:
  192.  
  193.              sinlook (30, b);
  194.  
  195.         returns the sine of 30 degrees as a real variable in 'b'.
  196.  
  197.      
  198.      8. Coslook is the same as sinlook except that it returns the cosine
  199.         in the second variable.  Thus,
  200.  
  201.              coslook (45, x);
  202.  
  203.         places the cosine of 45 degrees in the real variable, 'x'.
  204.  
  205.  
  206.      9. Ifloat is a function which creates a real number out of an integer.
  207.         Though you can accomplish this with a simple assignment statement in
  208.         Pascal, Ifloat performs it much, much faster.
  209.  
  210.         Use:
  211.  
  212.              y := ifloat (30);
  213.  
  214.         creates the internal floating point representation of '30' and puts it
  215.         in the real variable, 'y'.  It is included primarily for speed.
  216.  
  217.  
  218.  
  219.     10. Fltrunc takes a real number and essentially throws away the fractio-
  220.         nal portion of the n